package com.project.lk.nurseapp.utils;

import android.util.Log;

/**
 * 功能介绍：
 * 项目名：
 * 模块名称：
 * 作者：LK
 * 日期：2018/1/9
 * 修改日期：
 */
public class TypeUtils {

    private String mqiyacode;
    private boolean hasqiyacode;
    private String merrorcode;
    private boolean haserrorcode;
    private String mcode;
    private boolean hascode;
    private boolean has;
    private String mdata;

    public static int  getThermomterType(String thermom){
        double parseDouble = Double.parseDouble(thermom);
       if (parseDouble<36.1){

           return 0;//"低温"
       }else if (parseDouble>=36.1&&parseDouble<=37.4){

           return 1;//"正常"
       }else if (parseDouble>37.4&&parseDouble<38.1){

           return 2;//"低烧"
       }else {

           return 3;//"高烧"
       }
    }

    public static String getThermomterStr(String thermom){
        double parseDouble = Double.parseDouble(thermom);
        if (parseDouble<36.1){

            return "低温";//"低温"
        }else if (parseDouble>=36.1&&parseDouble<=37.4){

            return "正常";//"正常"
        }else if (parseDouble>37.4&&parseDouble<38.1){

            return "低烧";//"低烧"
        }else {

            return "高烧";//"高烧"
        }
    }

    public static void   showSphyErro(String type){

        switch (type){
            case "01":
                ToastUtils.showShortToast("测量过程中没有侦测到脉搏信号");
                break;
            case "02":
                ToastUtils.showShortToast("测量错误，测量过长中干扰过大。");
                break;
            case "03":
                ToastUtils.showShortToast("充气失败，充气时间过长或袖带漏气。");
                break;
            case "05":
                ToastUtils.showShortToast("测量失败，测量的结果高压与低压相差太大");
                break;
        }
    }


    public static int  getSphyType(String hightType,String shortType){
        int hightInt = Integer.parseInt(hightType);
        int shortInt = Integer.parseInt(shortType);
        if (hightInt<130&&hightInt>120&&shortInt<85&&shortInt>80){

            return 2;//"正常"
        }else if (hightInt>=100&&hightInt<=120&&shortInt<80&&shortInt>60){

            return 1;//"理想"
        }else if (hightInt<100&&shortInt<60){

            return 0;//"低压"
        }else if (hightInt<=139&&hightInt>=130&&shortInt<=89&&shortInt>85){

            return 3;//"正常偏高"
        }
        else if (hightInt<=159&&hightInt>=140&&shortInt<=99&&shortInt>=90){

            return 4;//"轻度"
        }
        else if (hightInt<=179&&hightInt>=160&&shortInt<=109&&shortInt>=100){

            return 5;//"中度"
        }
        else if(hightInt>=180&&shortInt>=110){

            return 6;//"重度"
        }else {
            return 2;//"正常"
        }
    }

    public static String  getSphyTypeStr(String hightType,String shortType){
        int hightInt = Integer.parseInt(hightType);
        int shortInt = Integer.parseInt(shortType);
        if (hightInt<130&&hightInt>120&&shortInt<85&&shortInt>80){

            return "正常";//"正常"
        }else if (hightInt>=100&&hightInt<=120&&shortInt<80&&shortInt>60){

            return "理想";//"理想"
        }else if (hightInt<100&&shortInt<60){

            return "低压";//"低压"
        }else if (hightInt<=139&&hightInt>=130&&shortInt<=89&&shortInt>85){

            return "偏高";//"正常偏高"
        }
        else if (hightInt<=159&&hightInt>=140&&shortInt<=99&&shortInt>=90){

            return "轻度";//"轻度"
        }
        else if (hightInt<=179&&hightInt>=160&&shortInt<=109&&shortInt>=100){

            return "中度";//"中度"
        }
        else if(hightInt>=180&&shortInt>=110){

            return "重度";//"重度"
        }else {
            return "正常";//"正常"
        }
    }


    public static int  getNoEatGlucoseType(String type){
        int intType = Integer.parseInt(type);
        if (intType<=110&&intType>=70){

            return 2;//"正常"
        }else if (intType>120){
            return 4; //较高
        }else if (intType<=120&&intType>110){
            return 3; //偏高
        }else if(intType<70&&intType>50){
            return 1; //偏低
        }else {
            return 0; //较低
        }
    }
    public static int  getEatGlucoseType(String type){
        int intType = Integer.parseInt(type);
        if (intType<=170&&intType>=120){
            return 2;//"正常"
        }else if (intType>170){
            return 3; //较高
        }else {
            return 1; //偏低
        }
    }

    public static String  getGlucoseTypeStr(String hightType,String shortType){
        int hightInt = Integer.parseInt(hightType);
        int shortInt = Integer.parseInt(shortType);
        if (hightInt<130&&hightInt>120&&shortInt<85&&shortInt>80){

            return "正常";//"正常"
        }else if (hightInt>=100&&hightInt<=120&&shortInt<80&&shortInt>60){

            return "理想";//"理想"
        }else if (hightInt<100&&shortInt<60){

            return "低压";//"低压"
        }else if (hightInt<=139&&hightInt>=130&&shortInt<=89&&shortInt>85){

            return "偏高";//"正常偏高"
        }
        else if (hightInt<=159&&hightInt>=140&&shortInt<=99&&shortInt>=90){

            return "轻度";//"轻度"
        }
        else if (hightInt<=179&&hightInt>=160&&shortInt<=109&&shortInt>=100){

            return "中度";//"中度"
        }
        else if(hightInt>=180&&shortInt>=110){

            return "重度";//"重度"
        }else {
            return "正常";//"正常"
        }
    }

}
